-
Notifications
You must be signed in to change notification settings - Fork 804
Rewriter generate consistent bindings #7643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Nielsbishere
wants to merge
10
commits into
microsoft:main
Choose a base branch
from
Oxsomi:rewriter_generate_consistent_bindings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rewriter generate consistent bindings #7643
Nielsbishere
wants to merge
10
commits into
microsoft:main
from
Oxsomi:rewriter_generate_consistent_bindings
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…he IDxcRewriter, this will allow generating register ids for registers that don't fully define them.
…ully qualified registers.
…allow passing different rewriter flags. Also added support for cbuffer auto bindings.
…dxil lowering properly, it's similar to -flegacy-resource-reservation but distinct in some key ways: the option only works for reserved registers and we need it to work on any register that has been compiled out. We also don't necessarily need the register to stay at the end of DXIL generation, in fact we'd rather not. Because having the register present can cause unintended performance penalties (for example, I use this reflection to know what transitions to issue)
✅ With the latest revision this PR passed the C/C++ code formatter. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, when resources are declared without explicit register bindings, DXC assigns them after
GlobalDCE
runs. This can lead to inconsistent register assignments across entry points (depending on optimizations), which causes mismatched resource IDs.A common case is bindless-style includes, e.g. declaring multiple textures without explicit bindings but with spaces. In this situation, the generated binaries may not match across different entry points or when compiling as a library.
Solution
This PR introduces a new flag:
When enabled, DXC will generate stable bindings by letting
GlobalDCE
eliminate only unused resources' symbols. Then, the bindings are generated and finally the unused resources are stripped again.This ensures consistent register assignments across all entry points, whether compiling as individual shaders or as a library.
-flegacy-resource-reservation
, but tailored for ensuring binding consistency.Example
Command:
Shader:
Generated bindings:
a
→t0
b
→t1
c
→u0
Both
main
andmain2
will consistently use the same bindings (b
att1
,c
atu0
), regardless of entry point or library compilation.Notes